package com.zerowidth.db.op;

import com.zerowidth.db.DBHelper;
import com.zerowidth.db.base.SqlResult;

import java.sql.SQLException;

public class DataConfigDB {

    public static String getValue(String key) {
        String sql = String.format("SELECT * FROM a_data_config WHERE data_key = '%s'", key);

        SqlResult sr = DBHelper.executeQueryEx(sql);

        if (sr == null || sr.rs == null) {
            return null;
        }

        try {
            if (sr.rs.next()) {
                return sr.rs.getString("data_value");
            }
        } catch (SQLException sqlException) {
            sqlException.printStackTrace();
        } finally {
            sr.close();
        }

        return null;
    }

}
